package com.note.back.service;


import com.note.back.mapper.UserMapper;
import com.note.back.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public User findByAccount(String account) {
        return userMapper.findByAccount(account);
    }

    public void register(String account, String pwdAfterHash, String salt, String email) {
        //进行注册
        userMapper.add(account, pwdAfterHash, salt, email);
    }

    public User findByUserEmail(String email) {
        return userMapper.findByUserEmail(email);
    }

    public void forgotPassword(int id, String pwdAfterHash) {
        userMapper.forgotPassword(id,pwdAfterHash);
    }

    public void update(User user) {
        userMapper.update(user);
    }

    public void updatePwd(Integer id, String password) {
        userMapper.updatePwd(password,id);
    }
}
